/**
 * @desc: 路由配置
 * @author zhangqiang
 * @date 2022/2/8
 */
 import Vue from "vue";
 import Router from "vue-router";

 Vue.use(Router);

export const constantRoutes = [
    {
        path: "",
        name: "",
        redirect: {
            name: "login",
        }
    },
    {
        path: "/login",
        name: "login",
        component: () => import("../views/login/index.vue"),
        meta: {
            title: "登录",
            roles: ["user", "admin"],
            icon: ""
        }
    },
    {
        path: "/home",
        name: "home",
        component: () => import("../views/home/index.vue"),
        meta: {
            title: "首页",
            icon: "icon-home"
        },
        children: [
            {
                path: "/sbgl",
                name: "sbgl",
                component: () => import("../views/sbgl/index"),
                meta: {
                    title: "设备管理",
                    icon: "icon-user-cog",
                    hidden: false
                }
            },
            {
                path: "/treeTest",
                name: "treeTest",
                component: () => import("../views/test/treeTest"),
                meta: {
                    title: "test",
                    icon: "icon-user-cog",
                    hidden: false
                }
            },
            {
                path: "/sbsj",
                name: "sbsj",
                component: () => import("../views/sbgl/sbsj"),
                meta: {
                    title: "设备升级",
                    icon: "icon-user-cog",
                    hidden: false
                }
            },
            {
                path: "/rygl",
                name: "rygl",
                component: () => import("../views/rygl/index"),
                meta: {
                    title: "人员管理",
                    icon: "icon-user-cog",
                    hidden: false
                }
            },
            {
                path: "/kqgl",
                name: "kqgl",
                component: () => import("../views/kqgl"),
                meta: {
                    title: "考勤管理",
                    icon: "icon-search-content",
                    hidden: false
                }
            },
            {
                path: "/zhgl",
                name: "zhgl",
                component: () => import("../views/zhgl/index"),
                meta: {
                    title: "账号管理",
                    icon: "icon-organization-s",
                    hidden: false,
                },

            },
            {
                path: "/rzgl",
                name: "rzgl",
                component: () => import("../views/rzgl/index"),
                meta: {
                    title: "日志管理",
                    icon: "icon-list-ul",
                    hidden: false,
                },

            },
            {
                path: "/sjkb",
                name: "sjkb",
                component: () => import("../views/kqgl/sjkb/index"),
                meta: {
                    title: "数据看板",
                    icon: "icon-list-ul",
                    hidden: false,
                },

            },
            {
                path: "/xtpz",
                name: "xtpz",
                component: () => import("../views/xtpz/index"),
                meta: {
                    title: "系统配置",
                    icon: "icon-list-ul",
                    hidden: false,
                },

            }
        ]
    },
    {
        path: "/dh",
        name: "dh",
        component: () => import("../views/dh/index"),
        meta: {
            title: "首页",
            icon: "",
            hidden: false
        }
    },
    {
        path: "/404",
        name: "error",
        component: () => import("../views/error/index"),
        meta: {
            title: "404",
            icon: "",
            hidden: true
        }
    },
    {
        path: "*",
        redirect: "/404",
        hidden: true
    }
]

const createRouter = () => new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({y: 0}),
    routes: constantRoutes
})
const router = createRouter()
 // const router = new Router({
 //     mode: "hash",
 //     routes: fixedRouter,
 //     linkActiveClass: "active-link"
 // });
 export default router;
